#pragma once

#include<iostream>
#include<pthread.h>
#include<vector>
#include<string>
#include<queue>
using namespace std;

static const int defaultnum=5;
struct ThreadInfo
{
    pthread_t tid;
    string name;
};

template<class T>
class ThreadPool
{
public:
    ThreadPool(int num=defaultnum)
    :threads_(num)
    {
        pthread_mutex_init(&mutex_,nullptr);
        pthread_cond_init(&cond_,nullptr);
    }
    void *HandlerTask(void *args)
    {

    }
    void Start()
    {
        int num=threads_.size();
        for(int i=0;i<num;i++)
        {
            threads_[i].name="thread-"+to_string(i);
            pthread_create(&threads_[i].tid,nullptr,HandlerTask,nullptr);
        }
    }
    void Push(const T &t)
    {
        tasks_
    }
    ~ThreadPool()
    {
        pthread_mutex_destroy(&mutex_);
        pthread_cond_destroy(&cond_);
    }
private:
    vector<ThreadInfo> threads_;
    queue<T> tasks_;

    pthread_mutex_t mutex_;
    pthread_cond_t cond_;
}
